#-*- coding: utf-8 -*-

from cocos.actions import IntervalAction
from cocos.cocosnode import CocosNode

class CTimerCall(IntervalAction):

	def init(self,delay,cbfunc,*args):
		self.duration=delay
		self.m_Callback=cbfunc
		self.m_args=args

	def update(self,t):
		if t<1.0:
			return
		if not hasattr(self,"m_Callback"):
			return
		func=self.m_Callback
		args=self.m_args
		del self.m_Callback
		del self.m_args
		func(*args)

class CObject(object):

	def Call_Out(self,delay,func,*args):
		oTimer=CTimerCall(delay,func,*args)
		self.do(oTimer)
